﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ServiceStack.ServiceHost;

namespace WebApplication2
{
    public class ProductService: ServiceStack.ServiceInterface.Service
    {
        private IProductRepository _repository;

        public ProductService(IProductRepository repository)
        {
            _repository = repository;
        }

        public Product Get(GetProduct request)
        {
            var productRepository = base.ResolveService<IProductRepository>();

            return new Product()
                {
                    InjectedHash = _repository.GetHashCode(),
                    ServiceLocatorHash = productRepository.GetHashCode()
                };
        }
    }
    

    [Route("/products", "GET")]
    public class GetProduct
    {
        
    }

    public class Product
    {
        public int InjectedHash { get; set; }
        public int ServiceLocatorHash { get; set; }
    }
}